package com.aiq.controller;

import com.aiq.pojo.Comment;
import com.aiq.service.CommentService;
import com.aiq.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: CommentController
 * @Description:
 * @Author: vie0134
 * @Date: 2021-01-13 14:50
 * @Version: 1.0
 **/
@RestController
@Api(tags = "实现评论各种操作")
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @ApiOperation(value = "添加评论",notes = "添加评论")
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public R addComment(@RequestBody Comment comment) {
        return commentService.insert(comment);
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public R updateComment(@RequestBody Comment comment) {
        return commentService.update(comment);
    }

}
